package com.suep.data_analysis.repository;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suep.data_analysis.model.Armament;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArmamentRepository extends BaseMapper<Armament> {

    /**
     * 根据条件查询音擎列表
     */
    @Select("SELECT * FROM t_armament WHERE ${ew.SQLSegment}")
    @Results({
            @Result(property = "armamentId", column = "armament_id"),
            @Result(property = "armamentName", column = "armament_name"),
            @Result(property = "armamentType", column = "armament_type"),
            @Result(property = "rarity", column = "rarity"),
            @Result(property = "baseAttack", column = "base_attack"),
            @Result(property = "secondaryStatType", column = "secondary_stat_type"),
            @Result(property = "secondaryStatValue", column = "secondary_stat_value"),
            @Result(property = "effectDescription", column = "effect_description"),
            @Result(property = "levelData", column = "level_data", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<Armament> selectArmament(@Param("ew") Wrapper<Armament> queryWrapper);

    /**
     * 查询所有音擎列表
     */
    @Select("SELECT * FROM t_armament")
    @Results({
            @Result(property = "armamentId", column = "armament_id"),
            @Result(property = "armamentName", column = "armament_name"),
            @Result(property = "armamentType", column = "armament_type"),
            @Result(property = "rarity", column = "rarity"),
            @Result(property = "baseAttack", column = "base_attack"),
            @Result(property = "secondaryStatType", column = "secondary_stat_type"),
            @Result(property = "secondaryStatValue", column = "secondary_stat_value"),
            @Result(property = "effectDescription", column = "effect_description"),
            @Result(property = "levelData", column = "level_data", typeHandler = com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler.class),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<Armament> selectAllArmament();
}